<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <!-- 
            子组件向父组件传递数据

            只能在当前的组件中进行接收
            v-slot="myscope"

            {{myscope.color}}
         -->
        <mynav v-slot="myscope">
            {{myscope.color}}
            <h1 :style="{color:myscope.color}">这是一个h1标签</h1>
        </mynav>
    </div>
    <script src="./node_modules/vue/dist/vue.js"></script>
    <script>

        let mynav = {
            template: "<div><slot :color='color'></slot></div>",
            data() {
                return {
                    color: "red"
                }
            }
        }

        const app = new Vue({
            el: '#app',
            data: {
                // color: "red"
            },
            components: {
                mynav
            }
        })
    </script>
</body>
</html>